package com.thinkTank.oa.base;


import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.thinkTank.oa.util.PageView;


@Transactional
public class BaseServiceImpl<T> implements BaseService<T> {

	private BaseMapper<T> baseMapper;
	
	
	public BaseMapper<T> getBaseMapper() {
		return baseMapper;
	}

	public void setBaseMapper(BaseMapper<T> baseMapper) {
		this.baseMapper = baseMapper;
	}

	@Override
	public List<T> queryAll(T t) {
		return this.getBaseMapper().queryAll(t);
	}

	@Override
	public void delete(Serializable id) {
		this.getBaseMapper().delete(id);
	}

	@Override
	public void update(T t) {
		this.getBaseMapper().update(t);
		
	}

	@Override
	public T getById(Serializable id) {
		return this.getBaseMapper().getById(id);
		
	}

	@Override
	public Integer add(T t) {
		return this.getBaseMapper().add(t);
		
		
	}

	@Override
	public PageView query(PageView pageView, T t) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("paging", pageView);
		map.put("t", t);
		List<T> list = this.getBaseMapper().query(map);
		pageView.setRecords(list);
		return pageView;
	}

	
	@Override
	public List<T> detailStatistics(String beginDate, String endDate, String userId) {
		return getBaseMapper().detailStatistics(beginDate, endDate, userId);
	}
	
	@Override
	public List<Map<String, String>> statisticsCount(String beginDate, String endDate) {
		return getBaseMapper().statisticsCount(beginDate, endDate);
	}
	
	@Override
	public List<T> queryInPidList(List<String> pidList) {
		return getBaseMapper().queryInPidList(pidList);
	}
}
